#define   _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>
int main()
{
	int i = 0;
	for (i = 0; i <= 100000; i++)
	{
		int sums = 0;
		int tmp = i;
		int count = 1;
		while (tmp /= 10)
		{
			count++;
		}
		tmp = i;
		while (tmp)
		{
			sums += pow(tmp % 10, count);
			tmp /= 10;
		}
		if (sums == i)
		{
			printf("%d ", sums);
		}
	}
	return 0;
}